Hello,
Module m = current // Current Module that the script is running from....
mod = edit(fullName(m), false, true, true) // Edit, invisible, silent, standard view
//Delete all attribute not in the skip list (!system attributes)
void DeleteAttributes(Module mod, Skip skpAttrNames)
{
AttrDef at
string err
print "Deleting Unneeded Attributes..."
for at in mod do
{
err = ""
string attr
if (!at.system) // verify that it's a custom attr
{
attr = at.name
if (!find(skpAttrNames, attr, attr)) //Delete what not ststed in the skip list (!system attributes)
{
print "\n\t" at.name
err = delete(mod, at) //Delete custom attr not stated in EP 03-04
if (err !="") { ack err; print "\t" err " [System Attr("at.system")]"}
else { print "\tDeleted OK" }
}
}
}
}
//Delete all unsed datatype within the module (!system attributes)
void DeleteDataTypes(Module mod)
{
AttrType at
string err
print "\n\nDeleting Used DataTypes..."
for at in mod do
{
err = ""
if (!at.system) // verify that it's a custom datatype
{
if (!isUsed(at)) //Check for use of datatype
{
print "\n\t" at.name
delete(at, err)
if (err !="") { ack err; "\tError Deleting: " err " [System Attr("at.system")]"}
else { print "\tDeleted OK" }
}
}
}
}
// ========= MAIN =========
Skip skpAttrNames = createString // KEY and DATA both 'string' Name of attr to delete
// Custom attributes to keep according to EP 03-04 Rev 1 - Hainan CNPE
//put(skpAttrNames, "xx", "xx")
put(skpAttrNames, "_Req Eval", "_Req Eval")
put(skpAttrNames, "_Req Type", "_Req Type")
put(skpAttrNames, "_Criticality", "_Criticality")
put(skpAttrNames, "_1E Req", "_1E Req")
put(skpAttrNames, "_NC+ Req", "_NC+ Req")
put(skpAttrNames, "_NC Req", "_NC Req")
put(skpAttrNames, "_Level 2 Req", "_Level 2 Req")
put(skpAttrNames, "_Level 3 Req", "_Level 3 Req")
put(skpAttrNames, "_Comments", "_Comments")
put(skpAttrNames, "_Remarks", "_Remarks")
put(skpAttrNames, "_IV&V ASW Req", "_IV&V ASW Req")
put(skpAttrNames, "_IV&V Feasible", "_IV&V Feasible")
put(skpAttrNames, "_IV&V Testable", "_IV&V Testable")
put(skpAttrNames, "_IV&V Comments", "_IV&V Comments")
put(skpAttrNames, "_IV&V Remarks", "_IV&V Remarks")
DeleteAttributes(mod, skpAttrNames) // Calling Func...
DeleteDataTypes(mod) // Calling Func...
save(mod) //Saving.....
close(mod) //Closing.....
delete(skpAttrNames) // Freeing memory...
SystemAdmin - Wed Dec 14 13:04:57 EST 2011 |